home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2003 July / CD 2 Debian 3.0r1 / Debian.iso / install / doc / cfdisk.txt next >
Encoding:
Text File  |  2002-05-17  |  17.5 KB  |  380 lines

  1. CFDISK(8)        Linux Programmer's Manual        CFDISK(8)
  2.  
  3.  
  4.  
  5. NAME
  6.        cfdisk - Curses based disk partition table manipulator for
  7.        Linux
  8.  
  9. SYNOPSIS
  10.        cfdisk [ -agvz ] [ -c cylinders ] [ -h heads ] [  -s  sec_
  11.        tors-per-track ] [ -P opt ] [ device ]
  12.  
  13. DESCRIPTION
  14.        cfdisk is a curses based program for partitioning any hard
  15.        disk drive.  Typical values of the device argument are:
  16.  
  17.           /dev/hda [default]
  18.           /dev/hdb
  19.           /dev/sda
  20.           /dev/sdb
  21.           /dev/sdc
  22.           /dev/sdd
  23.  
  24.        In order to write the partition table cfdisk  needs  some
  25.        thing  called  the  `geometry'  of the disk: the number of
  26.        `heads' and the number of `sectors per track'. Linux  does
  27.        not  use any geometry, so if the disk will not be accessed
  28.        by other operating systems,  you  can  safely  accept  the
  29.        defaults that cfdisk chooses for you. The geometry used by
  30.        cfdisk is found as follows. First the partition    table  is
  31.        examined,  to  see  what geometry was used by the previous
  32.        program that changed it. If the partition table is  empty,
  33.        or  contains  garbage,  or  does not point at a consistent
  34.        geometry, the kernel is asked for advice. If nothing works
  35.        255  heads  and    63 sectors/track is assumed. The geometry
  36.        can be overridden on the command line or by use of the `g'
  37.        command.  When  partitioning  an  empty large modern disk,
  38.        picking 255 heads and 63 sectors/track is  always  a  good
  39.        idea.   There  is  no need to set the number of cylinders,
  40.        since cfdisk knows the disk size.
  41.  
  42.        Next, cfdisk tries to read  the    current  partition  table
  43.        from  the  disk    drive.    If it is unable to figure out the
  44.        partition table, an error is  displayed    and  the  program
  45.        will  exit.  This might also be caused by incorrect geome
  46.        try information, and can  be  overridden  on  the  command
  47.        line.   Another    way  around  this  problem is with the -z
  48.        option.    This will ignore the partition table on the disk.
  49.  
  50.        The main display is composed of four sections, from top to
  51.        bottom: the header, the partitions, the command line and a
  52.        warning    line.    The  header contains the program name and
  53.        version number followed by the disk drive and  its  geome
  54.        try.   The  partitions section always displays the current
  55.        partition table.  The command line is the place where com
  56.        mands  and  text  are entered.  The available commands are
  57.        usually displayed in brackets.  The warning line  is  usu
  58.        ally  empty  except when there is important information to
  59.        be displayed.  The current partition is    highlighted  with
  60.        reverse    video  (or  an    arrow if the -a option is given).
  61.        All partition specific commands apply to the current  par
  62.        tition.
  63.  
  64.        The  format  of the partition table in the partitions sec
  65.        tion is, from left to right: Name, Flags, Partition  Type,
  66.        Filesystem  Type  and  Size.   The  name  is the partition
  67.        device name.  The flags can be Boot,  which  designates    a
  68.        bootable partition or NC, which stands for "Not Compatible
  69.        with DOS or OS/2".  DOS, OS/2 and possibly other operating
  70.        systems require the first sector of the first partition on
  71.        the disk and all logical partitions to begin on the second
  72.        head.   This  wastes the second through the last sector of
  73.        the first track of the first head  (the    first  sector  is
  74.        taken  by  the partition table itself).    cfdisk allows you
  75.        to recover these "lost" sectors with the maximize  command
  76.        (m).  Note: fdisk(8) and some early versions of DOS create
  77.        all partitions with the number of  sectors  already  maxi
  78.        mized.    For  more  information,  see the maximize command
  79.        below.  The partition type can be one of Primary or  Logi_
  80.        cal.   For  unallocated    space on the drive, the partition
  81.        type can also be Pri/Log, or empty (if the space is  unus
  82.        able).    The  filesystem type section displays the name of
  83.        the filesystem used on the partition, if known.    If it  is
  84.        unknown,  then Unknown and the hex value of the filesystem
  85.        type are displayed.  A special case occurs when there  are
  86.        sections  of  the  disk drive that cannot be used (because
  87.        all of the primary partitions are  used).   When  this  is
  88.        detected,  the  filesystem  type is displayed as Unusable.
  89.        The size field displays    the  size  of  the  partition  in
  90.        megabytes  (by  default).  It can also display the size in
  91.        sectors    and  cylinders    (see  the  change  units  command
  92.        below).     If an asterisks (*) appears after the size, this
  93.        means that the partition is not aligned on cylinder bound
  94.        aries.
  95.  
  96. DOS 6.x WARNING
  97.        The  DOS  6.x FORMAT command looks for some information in
  98.        the first sector of the data area of  the  partition,  and
  99.        treats this information as more reliable than the informa
  100.        tion in the partition table.  DOS FORMAT expects DOS FDISK
  101.        to  clear the first 512 bytes of the data area of a parti
  102.        tion whenever a size change occurs.  DOS FORMAT will  look
  103.        at  this extra information even if the /U flag is given --
  104.        we consider this a bug in DOS FORMAT and DOS FDISK.
  105.  
  106.        The bottom line is that if you  use  cfdisk  or    fdisk  to
  107.        change  the  size of a DOS partition table entry, then you
  108.        must also use dd to zero the first 512 bytes of that  par
  109.        tition  before  using  DOS FORMAT to format the partition.
  110.        For example, if you were using cfdisk to make a DOS parti
  111.        tion  table entry for /dev/hda1, then (after exiting fdisk
  112.        or cfdisk and rebooting Linux so that the partition  table
  113.        information  is    valid)    you  would  use  the  command "dd
  114.        if=/dev/zero of=/dev/hda1  bs=512  count=1"  to    zero  the
  115.        first 512 bytes of the partition. Note:
  116.  
  117.        BE  EXTREMELY  CAREFUL  if you use the dd command, since a
  118.        small typo can make all of the data on your disk  useless.
  119.  
  120.        For  best  results,  you  should always use an OS-specific
  121.        partition table program.  For example, you should make DOS
  122.        partitions with the DOS FDISK program and Linux partitions
  123.        with the Linux fdisk or Linux cfdisk program.
  124.  
  125.  
  126. COMMANDS
  127.        cfdisk commands can be entered by pressing the desired key
  128.        (pressing Enter after the command is not necessary).  Here
  129.        is a list of the available commands:
  130.  
  131.        b      Toggle bootable  flag  of  the  current  partition.
  132.           This  allows  you to select which primary partition
  133.           is bootable on the drive.
  134.  
  135.        d      Delete the current partition.   This  will  convert
  136.           the  current partition into free space and merge it
  137.           with any free  space  immediately  surrounding  the
  138.           current  partition.   A partition already marked as
  139.           free space or marked as unusable cannot be deleted.
  140.  
  141.        g      Change the disk geometry (cylinders, heads, or sec
  142.           tors-per-track).    WARNING: This option should  only
  143.           be  used by people who know what they are doing.    A
  144.           command line option is also available to change the
  145.           disk  geometry.    While at the change disk geometry
  146.           command line, you can choose  to    change    cylinders
  147.           (c),  heads  (h),  and  sectors per track (s).  The
  148.           default value will be printed at the  prompt  which
  149.           you can accept by simply pressing the Enter key, or
  150.           you can exit without changes by  pressing  the  ESC
  151.           key.  If you want to change the default value, sim
  152.           ply enter the desired value and press  Enter.   The
  153.           altered  disk  parameter    values do not take effect
  154.           until you return the main menu (by  pressing  Enter
  155.           or  ESC  at  the change disk geometry command line.
  156.           If you change  the  geometry  such  that    the  disk
  157.           appears  larger, the extra sectors are added at the
  158.           end of the disk as free space.  If the disk appears
  159.           smaller,    the  partitions  that  are beyond the new
  160.           last sector are deleted and the last  partition  on
  161.           the  drive  (or  the  free  space at the end of the
  162.           drive) is made to end at the new last sector.
  163.  
  164.        h      Print the help screen.
  165.  
  166.        m      Maximize disk usage of the current partition.  This
  167.           command  will  recover the the unused space between
  168.           the partition table and the beginning of the parti
  169.           tion,  but  at  the  cost  of  making the partition
  170.           incompatible with  DOS,  OS/2  and  possibly  other
  171.           operating systems.  This option will toggle between
  172.           maximal disk usage and DOS, OS/2,  etc.  compatible
  173.           disk  usage.  The default when creating a partition
  174.           is to create DOS, OS/2, etc. compatible partitions.
  175.  
  176.        n      Create  new partition from free space.  If the par
  177.           tition type is Primary or Logical, a  partition  of
  178.           that  type  will    be  created, but if the partition
  179.           type is Pri/Log, you will be prompted for the  type
  180.           you  want  to  create.  Be aware that (1) there are
  181.           only four slots available  for  primary  partitions
  182.           and (2) since there can be only one extended parti
  183.           tion, which contains all of the logical drives, all
  184.           of  the  logical drives must be contiguous (with no
  185.           intervening  primary   partition).    cfdisk   next
  186.           prompts  you for the size of the partition you want
  187.           to create.  The default size, equal to  the  entire
  188.           free  space of the current partition, is display in
  189.           megabytes.  You can either press the Enter  key  to
  190.           accept  the  default size or enter a different size
  191.           at the prompt.   cfdisk  accepts    size  entries  in
  192.           megabytes  (M)  [default], kilobytes (K), cylinders
  193.           (C) and sectors (S) by entering the number  immedi
  194.           ately  followed  by  one of (M, K, C or S).  If the
  195.           partition fills the free space available, the  par
  196.           tition  is created and you are returned to the main
  197.           command line.  Otherwise, the partition can be cre
  198.           ated at the beginning or the end of the free space,
  199.           and cfdisk will ask you to choose  where    to  place
  200.           the  partition.    After  the  partition is created,
  201.           cfdisk automatically adjusts the other  partition's
  202.           partition  types    if  all of the primary partitions
  203.           are used.
  204.  
  205.        p      Print the partition table to the    screen    or  to    a
  206.           file.  There  are several different formats for the
  207.           partition that you can choose from:
  208.  
  209.  
  210.           r      Raw data format (exactly what would be writ
  211.              ten to disk)
  212.  
  213.           s      Partition table in sector order format
  214.  
  215.           t      Partition table in raw format
  216.  
  217.           The  raw    data  format  will print the sectors that
  218.           would be written to disk    if  a  write  command  is
  219.           selected.   First,  the  primary partition table is
  220.           printed, followed by the partition  tables  associ
  221.           ated  with  each    logical  partition.   The data is
  222.           printed in hex byte by byte with 16 bytes per line.
  223.  
  224.           The  partition  table  in  sector order format will
  225.           print the partition table ordered by sector number.
  226.           The  fields,  from left to right, are the number of
  227.           the partition, the partition type, the  first  sec
  228.           tor,  the  last  sector,    the offset from the first
  229.           sector of the partition to the start of  the  data,
  230.           the  length  of  the partition, the filesystem type
  231.           (with the hex value in parenthesis), and the  flags
  232.           (with  the  hex value in parenthesis).  In addition
  233.           to the primary and  logical  partitions,    free  and
  234.           unusable    space  is printed and the extended parti
  235.           tion is printed before the first logical partition.
  236.  
  237.           If  a partition does not start or end on a cylinder
  238.           boundary or if the partition length is not  divisi
  239.           ble  by  the  cylinder  size,  an  asterisks (*) is
  240.           printed after the non-aligned sector  number/count.
  241.           This usually indicates that a partition was created
  242.           by an operating system that either does  not  align
  243.           partitions to cylinder boundaries or that used dif
  244.           ferent disk geometry information.  If you know  the
  245.           disk  geometry  of  the other operating system, you
  246.           could  enter  the  geometry  information    with  the
  247.           change geometry command (g).
  248.  
  249.           For  the    first  partition  on the disk and for all
  250.           logical partitions, if the offset from  the  begin
  251.           ning of the partition is not equal to the number of
  252.           sectors per track (i.e., the data does not start on
  253.           the first head), a number sign (#) is printed after
  254.           the offset.  For the remaining partitions,  if  the
  255.           offset  is  not zero, a number sign will be printed
  256.           after the offset.  This corresponds to the NC  flag
  257.           in the partitions section of the main display.
  258.  
  259.           The  partition  table  in raw format will print the
  260.           partition table ordered by  partition  number.   It
  261.           will  leave  out    all free and unusable space.  The
  262.           fields, from left to right, are the number  of  the
  263.           partition,  the  flags (in hex), the starting head,
  264.           sector and cylinder, the filesystem  ID  (in  hex),
  265.           the  ending head, sector and cylinder, the starting
  266.           sector in the partition and the number  of  sectors
  267.           in  the  partition.   The information in this table
  268.           can be directly translated to the raw data  format.
  269.  
  270.           The  partition  table  entries  only  have  10 bits
  271.           available to  represent  the  starting  and  ending
  272.           cylinders.   Thus, when the absolute starting (end
  273.           ing) sector number is on a  cylinder  greater  than
  274.           1023,  the  maximal  values  for    starting (ending)
  275.           head, sector and cylinder are printed.  This is the
  276.           method  used  by    OS/2, and thus fixes the problems
  277.           associated with OS/2's fdisk rewriting  the  parti
  278.           tion  table  when  it is not in this format.  Since
  279.           Linux and OS/2 use absolute sector counts, the val
  280.           ues  in  the  starting  and ending head, sector and
  281.           cylinder are not used.
  282.  
  283.        q      Quit program.  This will exit the  program  without
  284.           writing any data to disk.
  285.  
  286.        t      Change the filesystem type.  By default, new parti
  287.           tions are created as Linux  partitions,  but  since
  288.           cfdisk  can  create  partitions for other operating
  289.           systems, change partition type allows you to  enter
  290.           the hex value of the filesystem you desire.  A list
  291.           of the know filesystem types is displayed.  You can
  292.           type in the filesystem type at the prompt or accept
  293.           the default filesystem type [Linux].
  294.  
  295.        u      Change units of the  partition  size  display.   It
  296.           will  rotate  through megabytes, sectors and cylin
  297.           ders.
  298.  
  299.        W      Write partition table to disk (must enter an  upper
  300.           case  W).   Since  this  might  destroy data on the
  301.           disk, you must either confirm or deny the write  by
  302.           entering `yes' or `no'.  If you enter `yes', cfdisk
  303.           will write the partition table to disk and the tell
  304.           the  kernel to re-read the partition table from the
  305.           disk.  The re-reading of the partition table  works
  306.           is  most    cases,    but  I    have seen it fail.  Don't
  307.           panic.  It will be correct  after  you  reboot  the
  308.           system.    In all cases, I still recommend rebooting
  309.           the system--just to be safe.
  310.  
  311.        Up Arrow
  312.  
  313.        Down Arrow
  314.           Move cursor to the previous or next partition.   If
  315.           there  are more partitions than can be displayed on
  316.           a screen, you can display the next  (previous)  set
  317.           of  partitions  by  moving  down    (up)  at the last
  318.           (first) partition displayed on the screen.
  319.  
  320.        CTRL-L Redraws the screen.  In case something  goes  wrong
  321.           and  you    cannot read anything, you can refresh the
  322.           screen from the main command line.
  323.  
  324.        ?      Print the help screen.
  325.  
  326.        All of the commands can be entered with    either    upper  or
  327.        lower  case  letters  (except for Writes).  When in a sub-
  328.        menu or at a prompt to enter a filename, you can  hit  the
  329.        ESC key to return to the main command line.
  330.  
  331. OPTIONS
  332.        -a     Use  an  arrow  cursor instead of reverse video for
  333.           highlighting the current partition.
  334.  
  335.        -g     Do not use the geometry given by the  disk  driver,
  336.           but  try    to  guess  a  geometry from the partition
  337.           table.
  338.  
  339.        -v     Print the version number and copyright.
  340.  
  341.        -z     Start with zeroed partition table.  This option  is
  342.           useful  when  you  want  to repartition your entire
  343.           disk.  Note: this option does not zero  the  parti
  344.           tion  table  on  the disk; rather, it simply starts
  345.           the program without reading the existing    partition
  346.           table.
  347.  
  348.        -c cylinders
  349.  
  350.        -h heads
  351.  
  352.        -s sectors-per-track
  353.           Override the number of cylinders, heads and sectors
  354.           per track read from the  BIOS.   If  your  BIOS  or
  355.           adapter  does  not supply this information or if it
  356.           supplies incorrect information, use  these  options
  357.           to set the disk geometry values.
  358.  
  359.        -P opt Prints  the  partition  table in specified formats.
  360.           opt can be one or more of "r", "s" or "t".  See the
  361.           print  command  (above) for more information on the
  362.           print formats.
  363.  
  364. EXIT STATUS
  365.        0: No errors; 1: Invocation error; 2: I/O error; 3: cannot
  366.        get geometry; 4: bad partition table on disk.
  367.  
  368. SEE ALSO
  369.        fdisk(8), parted(8), sfdisk(8)
  370.  
  371. BUGS
  372.        The current version does not support multiple disks.
  373.  
  374. AUTHOR
  375.        Kevin E. Martin (martin@cs.unc.edu)
  376.  
  377.  
  378.  
  379. The BOGUS Linux Release    3 June 1995            CFDISK(8)
  380.